//
//  photoExhibitionDetailModel.m
//  PhotoCircle
//
//  Created by wujungao on 12/15/15.
//  Copyright © 2015 wujungao. All rights reserved.
//

#import "photoExhibitionDetailModel.h"
#import "photosModel.h"
#import "shareModel.h"

@interface photoExhibitionDetailModel()

@end

@implementation photoExhibitionDetailModel

#pragma mark - designated initializer
-(instancetype)initPhotoExhibitionDetailModelWithDict:(NSDictionary *)photoExhibitionDetailDict{
    
    self=[super init];
    
    if(self){
        
        self.UUID=photoExhibitionDetailDict[@"uuid"];
        self.comments_count=[photoExhibitionDetailDict[@"comments_count"] integerValue];
        [self configPhotoModelWithArr:photoExhibitionDetailDict[@"photos"]];
        [self configShareModelWithDict:photoExhibitionDetailDict[@"share"]];
    }
    
    return self;
}

#pragma mark - config method
-(void)configPhotoModelWithArr:(NSArray *)photoExhibitionDetailArray{
    
    [self.photoModelArray removeAllObjects];
    
    for(NSDictionary *dict in photoExhibitionDetailArray){
        
        photosModel *pM=[[photosModel alloc] initPhotosModelWithDict:dict];
        
        [self.photoModelArray addObject:pM];
    }
}

-(void)configShareModelWithDict:(NSDictionary *)dict{
    
    [self.shareModelArray removeAllObjects];
    
    shareModel *sM=[[shareModel alloc] initShareModelWithDict:dict];
    
    [self.shareModelArray addObject:sM];
}

#pragma mark - property
-(NSMutableArray *)photoModelArray{
    
    if(_photoModelArray==nil){
        
        _photoModelArray=[[NSMutableArray alloc] initWithCapacity:8];
    }
    
    return _photoModelArray;
}

-(NSMutableArray *)shareModelArray{
    
    if(_shareModelArray==nil){
        
        _shareModelArray=[[NSMutableArray alloc] initWithCapacity:8];
    }
    
    return _shareModelArray;
}

@end
